<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>34-字符串截取</title>
</head>
<body>
    <script>
        // substring  截取字符串
        // 语法：字符串.substring(起始索引号, [结束索引号])

        const str = 'abcdefg123乐'
        console.log(str.substring(3)) // defg123乐
        console.log(str.substring(0,4)) //  abcd
        console.log(str.substring(3,1)) //  bc

        // 取出最后一个字符
        console.log(str.substring(str.length - 1)) //  乐


        
    </script>
</body>
</html>